<%--
 *  File:    ChainHeadquarterEdit.jsp
 *  @Author: Jackyin
 *  Date:    2011/1/2
 *
 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%
  //init param
  Category cat = Category.getInstance("jsp.ChainHeadquarterEdit");
  String strModuleName = "ERM";
  String privilegeCode = "10906";
  String contextPath = request.getContextPath();
%>
<% //--------------------  include files list --%>

<%@ include file="/inc/CommonHeader.inc"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<html>
<head>
<title>ChainHeadquarterEdit</title>
<PageFlow:CheckPageFlow pageName="p_chainheadquarterdetail" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet"
	href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/Calendar.js"></script>
<%
String strDisplayFlag="";
if(request.getParameter("displayflag")!=null)
{
  strDisplayFlag=request.getParameter("displayflag");
}
String IsEdit="";
if(request.getParameter("orgid")!=null)
{
  IsEdit="edit";
}
%>
<script language="JavaScript">
function page_save()
{
	//alert(document.getElementsByTagName("html")[0].innerHTML);
	  if(!checkForm(document.cform))
	    return;
	  //  check
	  var zipcode=document.cform.zipcode.value;
	  if(zipcode!=""){
	  if(zipcode.length!=6){
	   alert("请输入正确的邮政编码");
	    return;
	      }
	  }
      //
	  document.cform.target = "_self";
	  if(document.cform.orgid.value==null || document.cform.orgid.value==""){
		  document.cform.actionname.value="add";
	   }
	  else{
		  document.cform.actionname.value="modify";
	  }
	  <%if(!(IsEdit).equals("edit")){%>					
	  setTimeout("__clickedTab(document.getElementById('attributeTab'),'/oval/zyl/masterdata/erm/ZylMasterdataRelationship.jsp?globalpccode=117');","800");
	  <%} %>
	   __submitData('chaincform',true);
     
}

var popwindow;

function page_setRegion(code,name)
{
  if(code != document.cform.regioncode.value)
  {
    document.cform.citycode.value = " ";
    document.cform.cityname.value = " ";
  }
  document.cform.regioncode.value = code;
  document.cform.regionname.value = name;
  if (popwindow != null)
    popwindow.close();
}

function page_selectProvince()
{
  if(popwindow!=null)
    popwindow.close();
  popwindow = window.open('<%=contextPath %>/masterdata/ogm/RegionSelect.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&countrycode=CN','newwindow', 'height=250, width=500,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no');
}

function page_selectCity(flag,grade)
{
  var regioncode = document.cform.regioncode.value;
  var parentcitycode = document.cform.citycode.value;
  if(flag=="city")parentcitycode='null';
  if(regioncode=="" || regioncode==-1)
  {
    alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_Province"))%>");
    return;
    if(parentcitycode=="" || parentcitycode==-1)
  {
    alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_City"))%>");
    return;
  }
  }
  var url='<%=contextPath %>/masterdata/ogm/CitySelect.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&countrycode=CN&regioncode=' + regioncode + '&flag=' + flag+'&grade='+grade;
  if(flag=="county"){
   url=url+'&parentcitycode='+parentcitycode;
  }
  if(popwindow!=null)
    popwindow.close();
  popwindow = window.open(url,'newwindow', 'height=250, width=400,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
}


function page_setCity(code,name,id,flag)
{
	if(flag == "county"){
		document.cform.countycode.value = code;
		document.cform.countyname.value = name;
	}else {
		document.cform.citycode.value = code;
		document.cform.cityname.value = name;
		document.cform.countycode.value = " ";
    	document.cform.countyname.value = " ";
	}
  if (popwindow != null)
    popwindow.close();
}


function page_setOrg(id,name,code)
{
  document.cform.parentorgid.value = id;
  document.cform.parentorgcode.value = code;  
  document.cform.parentorgname.value = name;
  var remote = window.open("","newwindow");
  if (remote != null)
    remote.close();
}

function setBusinessarea(id,areaname){
	document.cform.businessareaid.value=id;
	document.cform.areaname.value=areaname;
	
}

function popBusinessarea(){
	if(popwindow!=null) popwindow.close();
    url = '<%=contextPath %>/zyl/masterdata/erm/BusinessAreaPop.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=500, width=250,top=100,left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';
	popwindow = window.open(url,'newwindow', attribute);
}

function page_showExtendInfo(){
	document.getElementById("extendinfo").style.display="block";
	document.getElementById("hiddenbutton").style.display="block";
	document.getElementById("showbutton").style.display="none";
}
function page_hiddenExtendInfo(){
	document.getElementById("showbutton").style.display="block";
	document.getElementById("hiddenbutton").style.display="none";
	document.getElementById("extendinfo").style.display="none";
}
function page_back(){
	location.href="PharmacySummary.jsp?<%= OvalTools.randomURL() %>&summaryidentify=pharmacy&languagecode=<%=strLanguageCode%>&IsExternal=Y";
	//parent.location.href="PharmacySummary.jsp?<%= OvalTools.randomURL() %>&summaryidentify=distributor&languagecode=<%=strLanguageCode%>&IsExternal="+top.isExternal;
}


</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td class="summary_top"></td>
	</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0">
	<form id="chaincform" name="cform" method="post"
		action="<%=contextPath %>/Dispatcher" target="_self"><input
		type="hidden" name="pagename" value="p_chainheadquarterdetail">
	<custom:hidden property="detailactionname" changedName="actionname" />
	<custom:hidden property="detailactionname" /> <custom:hidden
		property="orgid" name="chainheaddetail" /> <custom:hidden
		property="infoid" name="chainheaddetail" />
	<tr>
		<td valign="top">
		<table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">
			<%if(!(strDisplayFlag).equals("view")){%>
		  <tr>
			 <td colspan="4" class="td_right"><a onclick="page_save()"><custom:button
			  type="2" label="L_Save" imgsrc="save_btn.gif" border="0" /></a></td>
		  </tr>
		  <%}%>
			<tr>
				<%
					HashMap chainheaddetail = (HashMap)pageContext.getAttribute("chainheaddetail");
					String chaincode = null;
					if(chainheaddetail!=null)chaincode = (String)chainheaddetail.get("chaincode");
					if(chaincode!=null){
				%>
				<td class="td-text" width="20%"><%= label.getLabelName("L_RefCode") + label.getLabelName("L_Colon") %></td>
				<td width="30%"><custom:text property="chaincode" name="chainheaddetail" readonly="true" style="border:0;width:100%"  size="20" /></td>
				<%}else{%>
				<td class="td-text" width="20%"><%= label.getLabelName("L_RefCode") + label.getLabelName("L_Colon") %></td>
				<td width="30%"><custom:text property="chaincode" name="chainheaddetail" size="20" /></td>
				<%}%>
				<td class="td-text" width="20%"><%= label.getLabelName("L_PharmacyCode") + label.getLabelName("L_Colon") %></td>
				<td width="30%"><custom:text property="referenceorgcode"
					name="chainheaddetail" readonly="true" style="border:0;width:100%" size="20" /></td>
			</tr>
			<tr>
				<td class="need"><%= label.getLabelName("L_PharmacyName") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="chainname" name="chainheaddetail"
					command="notnull" label="L_PharmacyName" /></td>
				<td class="td-text"><%=label.getLabelName("L_PharmacyShortName") +label.getLabelName("L_Colon") %></td>
				<td><custom:text property="shortname" name="chainheaddetail" /></td>
			</tr>
			<tr>
				<td class="need"><%= label.getLabelName("L_PCCodeName") + label.getLabelName("L_Colon") %></td>
				<td><custom:selectdic dictType="GlobalPCCode"
					property="globalpccode" name="chainheaddetail" valueCriteria="117"
					command="notnull" label="L_PCCodeName" disabled="true"></custom:selectdic>
				</td>

				<td class="need"><%= label.getLabelName("L_Province") + label.getLabelName("L_Colon") %></td>
				<td>
				<%if(!isView){ %> <custom:text property="regioncode"
					name="chainheaddetail" command="notnull" label="L_Province"
					size="10" readonly="true" /> <a
					onclick="javascript:page_selectProvince();"><custom:button
					type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a> <custom:text
					property="regionname" name="chainheaddetail" readonly="true"
					size="20" /> <%}else{ %> <custom:write property="regioncode"
					name="chainheaddetail" nbsp="true"></custom:write> <custom:write
					property="regionname" name="chainheaddetail" nbsp="true"></custom:write>
				<%} %>
				</td>
			</tr>
			<tr>
				<td class="td-text"><%= label.getLabelName("L_City") + label.getLabelName("L_Colon") %></td>
				<td>
				<%if(!isView){ %> <custom:text property="citycode"
					name="chainheaddetail" size="10" readonly="true" /> <a
					onclick="javascript:page_selectCity('city',1);"><custom:button
					type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a> <custom:text
					property="cityname" name="chainheaddetail" readonly="true"
					size="20" /> <%}else{ %> <custom:write property="citycode"
					name="chainheaddetail" nbsp="true"></custom:write> <custom:write
					property="cityname" name="chainheaddetail" nbsp="true"></custom:write>
				<%} %>
				</td>

				<td class="td-text"><%= label.getLabelName("L_County") + label.getLabelName("L_Colon") %></td>
				<td>
				<%if(!isView){ %> <custom:text property="countycode"
					name="chainheaddetail" size="10" readonly="true" /> <a
					onclick="javascript:page_selectCity('county',2);"><custom:button
					type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a> <custom:text
					property="countyname" name="chainheaddetail" readonly="true"
					size="20" /> <%}else{ %> <custom:write property="countycode"
					name="chainheaddetail" nbsp="true"></custom:write> <custom:write
					property="countyname" name="chainheaddetail" nbsp="true"></custom:write>
				<%} %>
				</td>
			</tr>
			<tr>
				<!-- 
        	<td class="td-text" ><%= label.getLabelName("L_ParentOrgShortName") + label.getLabelName("L_Colon") %></td>
            <td>
            	<custom:text property="parentorgcode" name="pharmacydetail" readonly="true" size="10"></custom:text>
            	<a onclick="popup('<%=contextPath %>/masterdata/ogm/OrgSelect.jsp?<%= OvalTools.randomURL() %>','newwindow','height=250, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no')"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
            	<custom:text  property="parentorgname" name="pharmacydetail" readonly="true" size="20"></custom:text>
            </td>
        
           
            <td class="need"><%= label.getLabelName("L_TerminalType") + label.getLabelName("L_Colon") %></td>
            <td><custom:selectdic dictType="PharmacyType"  property="pharmacytype" name="pharmacydetail" defaultValue="------" defaultValueCost=" " command="notnull" label="L_TerminalType" valueCriteria="11,12"/></td>
          <td class="need"><%= label.getLabelName("L_Status") + label.getLabelName("L_Colon") %></td>
            <td><custom:select optionsName="allstatus" optionValueKey="statuscode"  optionInnerTextKey="statusname" name="pharmacydetail" property="status" command="notnull" label="L_Status"/></td>
         -->


				<td class="need"><%= label.getLabelName("L_Attribute") + label.getLabelName("L_Colon") %></td>
				<td><custom:selectdic dictType="ChainHeadquarterType"
					name="chainheaddetail" property="chainheadquartertype"
					command="notnull" label="L_Attribute" defaultValue="-----"
					defaultValueCost=" " /></td>
				<%--<td class="need"><%= label.getLabelName("L_BusinessAreaName") + label.getLabelName("L_Colon") %></td>
            	<td>
				<custom:hidden name="chainheaddetail" property="businessareaid"/>
				<%if(!isView){ %> 
				<custom:text name="chainheaddetail" property="areaname" command="notnull" label="L_BusinessAreaName" readonly="true"/>
				<%}else{ %>
				<custom:text name="chainheaddetail" property="areaname" command="notnull" label="L_BusinessAreaName"/>
				<%} %>
				<a onclick="popBusinessarea()"><custom:button type="3" value="*"/></a>
            	</td>
			--%>
				<td class="need"><%= label.getLabelName("L_Responsibility") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="manager" name="chainheaddetail"
					command="notnull" label="L_Responsibility" size="20" /></td>
				
			</tr>

			<tr>
				<td class="td-text"><%= label.getLabelName("L_TurnoverTime") + label.getLabelName("L_Colon") %></td>
				<td>
				 <custom:text property="datelastupdated" dataType="date" name="chainheaddetail" dataFormatName="dateformat" size="20"  label="L_TurnoverTime" onfocus="c.show(this,'cform.datelastupdated','yyyy-MM-dd')" />
				
				</td>
					<td class="td-text"><%= label.getLabelName("L_Franchiseno") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="franchiseno" name="chainheaddetail"
					size="20" command="notnegative" label="L_Franchiseno"
					dataType="integer" /></td>

			</tr>
			<tr>
			
				<td class="td-text"><%= label.getLabelName("L_Totalpharmacy") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="totalpharmacy"
					name="chainheaddetail" dataType="integer" command="notnegative"
					label="L_Totalpharmacy" size="20" /></td>
                   <td class="need"><%= label.getLabelName("L_Status") + label.getLabelName("L_Colon") %></td>
				<td><custom:select optionsName="allstatus"
					optionValueKey="statuscode" optionInnerTextKey="statusname"
					name="chainheaddetail" property="status" command="notnull"
					label="L_Status" /></td>
			</tr>


			<tr>
				
				<td class="td-text"><%= label.getLabelName("L_AddressLine1") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="address" name="chainheaddetail"
					label="L_ReceiptMan" size="40" label="L_AddressLine1" /></td>

         <td class="td-text"><%= label.getLabelName("L_telephone") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="telephone" name="chainheaddetail" /></td>

			</tr>
			<tr>
				
				<td class="td-text"><%= label.getLabelName("L_Fax") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="fax" name="chainheaddetail" /></td>
				<td class="td-text"><%= label.getLabelName("L_ZipCode1") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="zipcode" name="chainheaddetail" /></td>
			</tr>
			<tr>
				
				<td class="td-text"><%= label.getLabelName("L_Email") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="email" name="chainheaddetail" /></td>
	          <td class="td-text"><%= label.getLabelName("L_URL") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="url" name="chainheaddetail" /></td>
			</tr>
		
			<tr>
				<td class="td-text"><%= label.getLabelName("L_Comments") + label.getLabelName("L_Colon") %></td>
				<td colspan="3"><custom:text name="chainheaddetail"
					property="comments" size="100" /></td>
			</tr>
		</table>
		<div id="showbutton" style="display: block">
		<table border="1" cellspacing="0" bordercolorlight="#999999"
			bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">
			<tr>
				<td height="49" class="td_right"><a
					onclick="page_showExtendInfo()"><input type="button"
					class="button1" style="display: block"
					value="<%= label.getLabelName("L_ExtendedInformationDisplay") %>"
					style="width:100"></a></td>
			</tr>
		</table>
		</div>
		<div id="hiddenbutton" style="display: none">
		<table border="1" cellspacing="0" bordercolorlight="#999999"
			bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">
			<tr>
				<td height="49" class="td_right"><a
					onclick="page_hiddenExtendInfo()"><input type="button"
					class="button1" style="display: block"
					value="<%= label.getLabelName("L_HiddenExtensionInformation") %>"
					style="width:100"></a></td>
			</tr>
		</table>
		</div>
		<div id="extendinfo" style="display: none">
		<table border="1" cellspacing="0" bordercolorlight="#999999"
			bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">

			<tr>
				<td colspan="4" class="deepblue-left"><img
					src="../../../images/cn/quote.gif"> <%=label.getLabelName("L_OrgRegistrationInfo") %>

				</td>
			</tr>

			<tr>
				<td class="td-text" width="20%"><%=label.getLabelName("L_OrgOpenDate") +label.getLabelName("L_Colon") %></td>
				<td width="30%">
				<%if(!isView){ %> 
				
				<custom:text property="opendate"
					name="chainheaddetail" dataType="date" dataFormatName="dateformat"
					size="20" readonly="true" onfocus="c.show(this,'cform.opendate','yyyy-MM-dd')" /> <%}else{ %>
				<custom:write property="opendate" name="chainheaddetail" nbsp="true"></custom:write>
				<%} %>
				</td>
				<td class="td-text" width="20%"><%=label.getLabelName("L_CorporatePerson") +label.getLabelName("L_Colon") %></td>
				<td width="30%"><custom:text property="corporateperson"
					name="chainheaddetail" size="20"></custom:text></td>
			</tr>
			<tr>
				<td class="td-text" width="20%"><%=label.getLabelName("L_CorpTypeName") +label.getLabelName("L_Colon") %></td>
				<td width="30%"><custom:selectdic dictType="CorporationType"
					name="chainheaddetail" property="corporationtype"
					defaultValue="-----" defaultValueCost=" "></custom:selectdic></td>
				<td class="td-text" width="20%"><%=label.getLabelName("L_Registerfund") +label.getLabelName("L_Colon") %></td>
				<td>
				<% String af = (String)session.getAttribute("amountformat"); %> <custom:text
					property="registerfund" name="chainheaddetail" size="20"
					label="L_Registerfund" dataType="number" dataFormat="<%=af %>"></custom:text>
				</td>
			</tr>
			<tr>
				<td class="td-text" width="20%"><%=label.getLabelName("L_LicenseNumber") +label.getLabelName("L_Colon") %></td>
				<td><custom:text property="licenceno" name="chainheaddetail"
					size="20" label="L_LicenseNumber">
				</custom:text></td>
				<td class="td-text" width="20%"><%=label.getLabelName("L_BankName") +label.getLabelName("L_Colon") %></td>
				<td><custom:text property="accountbank" name="chainheaddetail"
					size="20" label="L_BankName">
				</custom:text></td>
			</tr>
			<tr>
				<td class="td-text" width="20%"><%=label.getLabelName("L_BankAccount") +label.getLabelName("L_Colon") %></td>
				<td><custom:text property="accountno" name="chainheaddetail"
					size="20" label="L_BankAccount">
				</custom:text></td>
				<td class="td-text" width="20%"><%=label.getLabelName("L_VATRegistrationNumber") +label.getLabelName("L_Colon") %></td>
				<td><custom:text property="taxno" name="chainheaddetail"
					size="20" label="L_VATRegistrationNumber">
				</custom:text></td>
			</tr>
			<tr>
				<td class="td-text" width="20%"><%=label.getLabelName("L_RegisteredAddress") +label.getLabelName("L_Colon") %></td>
				<td colspan="3"><custom:text property="registeraddress"
					name="chainheaddetail" size="100" label="L_RegisteredAddress">
				</custom:text></td>
			</tr>
		</table>
		</div>
		</td>
	</tr>
	<tr>
		<td class="summary_top"></td>
	</tr>
	</form>
</table>
<table width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td class="td_center">
		<a onclick="__back()"><custom:button type="2" label="L_Back" imgsrc="delete.gif" border="0" style="width:60"/></a>
		</td>
	</tr>
</table>
</body>
<script>
  var list=document.getElementsByTagName("input");
  m=list.length
  list[m-1].style.display='none';
</script>
</html>
